<?php echo $this->doctype() ?>
<html
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:og="http://ogp.me/ns#"
	xmlns:fb="http://www.facebook.com/2008/fbml"
	<?php if( defined('USING_FIREBUG_LITE') && USING_FIREBUG_LITE == TRUE ) echo 'debug="true"' ?> 
>
    <head>
        <script type="text/javascript">
			if( top === window )
			{
                top.location.href = "<?php echo $this->social->pageUrl(array('redirect_url' => $this->url()), $this->id_page) ?>";
			}
		</script>
        <title><?php echo $this->translate('APP_NAME') . " - " . $this->id_page; ?></title>  
		<link rel="shortcut icon" href="<?php echo STATIC_URL ?>/img/favicon.ico" />
		<?php echo $this->headMeta() ?>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<link rel="stylesheet" type="text/css" href="<?php echo STATIC_URL . '/css/common.css?v=' . SKIN_VERSION ?>" />
		<link rel="stylesheet" type="text/css" href="<?php echo REPOSITORY_URL . '/javascript/cloud-zoom'; ?>/cloud-zoom.css" media="screen">
		<link rel="stylesheet" type="text/css" href="<?php echo REPOSITORY_URL . '/javascript/superfish'; ?>/css/superfish.css" media="screen">
		<link rel="stylesheet" type="text/css" href="<?php echo REPOSITORY_URL . '/javascript/tipsy/tipsy.css?v=' . SKIN_VERSION?>" />
        <link rel="stylesheet" type="text/css" href="<?php echo STATIC_URL . '/css/fanpage.css?v=' . SKIN_VERSION ?>" />
		<?php if( $this->layout == Core_Model_DbTable_Stores::LAYOUT_4x16):?>
			<link rel="stylesheet" type="text/css" href="<?php echo STATIC_URL . '/css/layout.css?v=' . SKIN_VERSION ?>" />
		<?php endif;?>
		
		<?php echo $this->headLink(); ?>
		<?php echo $this->headScript(); ?>
		<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
		<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
        <script type="text/javascript" src="<?php echo STATIC_URL . "/javascript/jquery.number_format.js" ?>"></script>
        <script type="text/javascript" src="<?php echo STATIC_URL . "/javascript/shopping_cart.js" ?>"></script>
		<script type="text/javascript" src="<?php echo REPOSITORY_URL .  '/javascript/tipsy/jquery.tipsy.js?v=' . SKIN_VERSION?>"></script>
		<script type="text/javascript" src="<?php echo STATIC_URL . "/javascript/common.js" ?>"></script>
		<script type="text/javascript" src="<?php echo REPOSITORY_URL . '/javascript/superfish'; ?>/js/hoverIntent.js"></script>		
		<script type="text/javascript" src="<?php echo REPOSITORY_URL . '/javascript/superfish'; ?>/js/superfish.js"></script>
		<script type="text/javascript" src="<?php echo REPOSITORY_URL . '/javascript/superfish'; ?>/js/supersubs.js"></script>
		<script type="text/javascript" src="<?php echo REPOSITORY_URL . '/javascript/cloud-zoom'; ?>/cloud-zoom.1.0.2.js"></script>
		<?php echo $this->social->render('initHead'); ?>
		<script type="text/javascript">
			// initialise plugins
			$(document).ready(function(){
				$('ul.sf-menu').supersubs({ 
					minWidth:    12,   
					maxWidth:    50,  
					extraWidth:  1    
				}).superfish();
				$('.link_show_more').click(function(){
					if ($(this).siblings(".show_more").is(":hidden")) {
						$(this).siblings(".show_more").slideDown();
						$(this).siblings(".show_more").attr('style','display: inline');
						$(this).hide();
					}
					return false;
				});
				$('.link_show_less').click(function(){
					if (!$(this).parent(".show_more").is(":hidden")) {
						$(this).parent(".show_more").slideUp();
						$(this).parent('.show_more').siblings(".link_show_more").show();
					}
					return false;
				});
			});
		</script>
		<?php if( defined('USING_FIREBUG_LITE') && USING_FIREBUG_LITE == TRUE):?>
			<script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script>
		<?php endif ?>
		<?php if($this->layout == Core_Model_DbTable_Stores::LAYOUT_3xAll && isset($this->pageValues) ):?>
			<script type="text/javascript" src="<?php echo REPOSITORY_URL . '/javascript'; ?>/jquery.masonry.min.js"></script>
			<script type="text/javascript" src="<?php echo REPOSITORY_URL . '/javascript'; ?>/masonry.js"></script>
		<?php endif;?>
		<?php if (!empty($this->store->css)):?>
			<link rel="stylesheet" type="text/css" href="<?php echo STATIC_URL . '/upload/' . STORE_CSS_FOLDER . '/' .$this->store->css ?>" />
		<?php endif;?>
    </head>
	<body>
		<div id="master_container">
			<?php echo $this->social->render('initBody'); ?>
			<?php if ($this->social->isPageAdmin()): ?>		
				<div class="sm_admin_pannel" style="height:48px">
					<div class="sm_admin_setting">
						<a class="sm_admin_setting_text" target="_blank" title="Go to Admin" 
						   href="<?php echo $this->social->url('/store/store/list/id_page/' . $this->social->getIdPage()); ?>" >
							Admin panel
						</a>
					</div>
					<div class="sm_paypal" style="float: right;">
						 <?php echo $this->partial('campaign.admin.phtml', 'payment', array('social' => $this->social));?>
					</div>
				</div>
			<?php else: ?>
				<?php echo $this->partial('campaign.phtml', 'payment', array('social' => $this->social));?>
			<?php endif; ?>

			    
				<?php if (!empty($this->store)): ?>                    
					<?php if((!empty($this->store->link))&&(!empty($this->store->banner_image))):?>
                        <div class="sm_banner"> 
                            <?php 
                                $url = $this->store->link;
                                $url = substr($url,0,4)=='http'?$url:'http://'.$url;                                
                            ?>
						<a href="<?php echo $url?>" target="_blank">
							<img style="border: none" src="<?php echo $this->store->getBannerImageUrl() ?>"/>
						</a>					
                        </div>
					<?php elseif(!empty($this->store->banner_image)):?>
							<?php 
                                $url = $this->store->link;
                                $url = substr($url, 0, 4) == 'http' ? $url : 'http://' . $url;
							?>
						<div class="sm_banner"> 
							<img style="border: none" src="<?php echo $this->store->getBannerImageUrl() ?>"/>
						</div>
					<?php endif;?>
				<?php endif; ?>
            
            
			<?php if (!empty($this->store)): ?>
				<div class="sm_store_name">
					<span class="name"><?php echo $this->escape($this->store->getName()); ?></span>					
					<div class="sm_share_like" style="display:block">
							<?php
							echo $this->social->render('shareUrl', array(
								'url' => $this->social->getShareUrl('/store/share/store/id_store/' . $this->store->id . '/id_page/' . $this->social->getIdPage()),
								'send' => false,
								'width' => 'auto',
								'layout'=>'full'
							));
							?>
					</div>
					<div class="more-less">
						<?php echo $this->store->getDescription(); ?>
					</div>
				</div>
			<?php endif; ?>

			<?php if (!empty($this->store->id)): ?>
				<div class="sm_fanpage_menu">                    
				</div> 
				<div class="sm_fanpage_contents">
					<?php echo $this->layout()->content; ?>
				</div>
			<?php else: ?>
                <a target="_blank" href="http://media.younetco.com">
					<img class="image_banner" src="//s3.amazonaws.com/younetmedia/contact/public/media/skin/classic/image/banner_default.jpg?v=0.2.1" style="max-width: 810px;border:none" />
				</a>
				<div style="clear:both; height: 21px;">&nbsp;</div>
				<div style="padding-right: 2px;">
					<div class="sm_paginator_item_empty fanpage">
						<?php echo $this->translate('MSG_UNDER_CONSTRUCTION'); ?>   
					</div>
				</div>			
			<?php endif; ?>		
		</div>
		<?php
			echo $this->partial('footer.phtml', 'payment', array('social' => $this->social))
		?>
        <?php
            if(!empty($this->store->google_analytics_id))
            {
                echo $this->partial('google_analytics/google_analytics.phtml', array('google_analytics_id' => $this->store->google_analytics_id));
            }
        ?>
		<?php echo $this->social->render('endBody') ?>
	</body>
</html>
